package buzzword.gui;

import java.awt.GridBagLayout;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;

import java.awt.Rectangle;
import javax.swing.JLabel;

public class MainMenuPanel extends JPanel {

	private static final long serialVersionUID = 1L;
	private JButton buttonListAllGames = null;
	private JButton buttonCreateGame = null;
	private JButton buttonExit = null;
	/**
	 * This is the default constructor
	 */
	public MainMenuPanel() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(400, 400);
		this.setLayout(null);
		this.setOpaque(false);
		this.add(getButtonListAllGames(), null);
		this.add(getButtonCreateGame(), null);
		this.add(getButtonExit(), null);
	}

	/**
	 * This method initializes buttonListAllGames	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getButtonListAllGames() {
		if (buttonListAllGames == null) {
			buttonListAllGames = new JButton();
			buttonListAllGames.setBounds(new Rectangle(45, 45, 316, 61));
			buttonListAllGames.setText("List all Games");
			buttonListAllGames.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					((GuiMainFrame)SwingUtilities.getRoot(MainMenuPanel.this)).switchActionPanel(new ListAllGamesPanel());
				}
			});
		}
		return buttonListAllGames;
	}

	/**
	 * This method initializes buttonCreateGame	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getButtonCreateGame() {
		if (buttonCreateGame == null) {
			buttonCreateGame = new JButton();
			buttonCreateGame.setBounds(new Rectangle(45, 135, 316, 61));
			buttonCreateGame.setText("Create a Game");
			buttonCreateGame.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					((GuiMainFrame)SwingUtilities.getRoot(MainMenuPanel.this)).switchActionPanel(new CreateGamePanel());
				}
			});
		}
		return buttonCreateGame;
	}

	/**
	 * This method initializes buttonExit	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getButtonExit() {
		if (buttonExit == null) {
			buttonExit = new JButton();
			buttonExit.setBounds(new Rectangle(45, 285, 316, 77));
			buttonExit.setText("Exit");
			buttonExit.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					System.exit(0);
				}
			});
		}
		return buttonExit;
	}

}
